package com.cnware.capture.ui.view.navigator.resource;

import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

import com.cnware.capture.model.Task;
import com.cnware.capture.ui.view.navigator.NavigatorItem;

public class TaskItem implements NavigatorItem {
	
	private Task task;
	
	private NavigatorItem project;
	
	public TaskItem(Task task) {
		this.task = task;
	}

	@Override
	public Object[] getChildren() {
		return new Object[0];
	}

	@Override
	public Object getParent() {
		return this.project;
	}

	@Override
	public boolean hasChildred() {
		return false;
	}

	@Override
	public void setParent(NavigatorItem item) {
		this.project = item;
	}

	@Override
	public String getText() {
		return this.task.getName();
	}

	@Override
	public Image getImage() {
		// TODO change the resource to one class to manager and disposed.
		return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
	}

}
